var LightBox = new Class({
	initialize: function() {}
});
LightBox.show = function() {
	if (!$("lightBoxOverlay") && !$("lightBoxHideSelect") && !$("lightBoxLoad")) {
		new Element('iframe').setProperty('id', 'lightBoxHideSelect').inject($(document.body));
		$('lightBoxHideSelect').setOpacity(0);
		new Element('div').setProperty('id', 'lightBoxOverlay').inject($(document.body));
		$('lightBoxOverlay').setOpacity(0.6);
		LightBox.size();
		
		new Element('div').setProperty('id', 'lightBoxLoad').inject($(document.body));
		$('lightBoxLoad').set('html', '<img alt="" src="../Images/Loading.gif" />');
		LightBox.position();
	}
	window.addEvent('scroll', LightBox.active);
	window.addEvent('resize', LightBox.active);
}
LightBox.remove = function() {
	if ($("lightBoxOverlay") && $("lightBoxHideSelect") && $("lightBoxLoad")) {
		$('lightBoxLoad').dispose();
		$('lightBoxOverlay').set('tween', {
			duration: 250,
			onComplete: function(){
				$('lightBoxOverlay').dispose();
			}
		});
		$('lightBoxOverlay').tween('opacity', 0.6, 0);
		$('lightBoxHideSelect').dispose();
	}
	$(window).removeEvent('scroll', LightBox.active);
	$(window).removeEvent('resize', LightBox.active);
	return false;
}
LightBox.active = function(){
	LightBox.position();
    LightBox.size();
}

LightBox.size = function(){
	// we have to set this to 0px before so we can reduce the size / width of the overflow onresize 
	$("lightBoxOverlay").setStyles({
		"height": '0px',
		"width": '0px'
	});
	$("lightBoxHideSelect").setStyles({
		"height": '0px',
		"width": '0px'
	});
	var size = $(window).getScrollSize();
	$("lightBoxOverlay").setStyles({
		"height": size.y + 'px',
		"width": size.x + 'px'
	});
	$("lightBoxHideSelect").setStyles({
		"height": size.y + 'px',
		"width": size.x + 'px'
	});
}
LightBox.position = function(){
	if ($("lightBoxLoad")) {
		var scrollsize = $(window).getScroll();
		var size = $(window).getSize();
		$("lightBoxLoad").setStyles({
			left: (scrollsize.x + (size.x - 56) / 2) + 'px',
			top: (scrollsize.y + ((size.y - 20) / 2)) + 'px'
		});
	}
}




